package Presentacion;


import java.awt.Image;
import java.awt.Toolkit;
import javax.swing.JFrame;
import AccesoDatos.Conexion;
import java.awt.Dimension;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Cris
 */
public class frmMain extends javax.swing.JFrame {
        
    Conexion conexion = null;
    
    public frmMain(Conexion Pconexion) {
        conexion = Pconexion;
        initComponents();        
//        Toolkit kit = myFrame.getToolkit();
//        Dimension screenSize = kit.getScreenSize();
//        int screenWidth = screenSize.width;
//        int screenHeight = screenSize.height;
//        Dimension windowSize = myFrame.getSize();
//        int windowWidth = windowSize.width;
//        int windowHeight = windowSize.height;
//        int X = (screenWidth - windowWidth)/2;
//        int Y = (screenHeight - windowHeight)/2;
//        myFrame.setLocation(X, Y);
        
    }
    @Override
    public Image getIconImage() {
        Image retValue = Toolkit.getDefaultToolkit().getImage(ClassLoader.getSystemResource("src/imagenes/app.png"));
        return retValue;
    }
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jMenuBar2 = new javax.swing.JMenuBar();
        jMenu3 = new javax.swing.JMenu();
        jMenu4 = new javax.swing.JMenu();
        jDesktopPane1 = new javax.swing.JDesktopPane();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        menuArchivo = new javax.swing.JMenu();
        jMenuItem2 = new javax.swing.JMenuItem();
        manuEditar = new javax.swing.JMenu();
        jMenuItem10 = new javax.swing.JMenuItem();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItem9 = new javax.swing.JMenuItem();
        menuModulos = new javax.swing.JMenu();
        menuCobro = new javax.swing.JMenu();
        jMenuItem3 = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        menuLocalizaciones = new javax.swing.JMenu();
        jMenuItem8 = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JPopupMenu.Separator();
        menuAdministracion = new javax.swing.JMenu();
        jMenuItem5 = new javax.swing.JMenuItem();
        jMenuItem6 = new javax.swing.JMenuItem();
        jMenuItem7 = new javax.swing.JMenuItem();
        menuAyuda = new javax.swing.JMenu();
        jMenuItem11 = new javax.swing.JMenuItem();
        jMenuItem4 = new javax.swing.JMenuItem();

        jMenu3.setText("File");
        jMenuBar2.add(jMenu3);

        jMenu4.setText("Edit");
        jMenuBar2.add(jMenu4);

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("SICGSA - Sistema Integrado de Cobro GUATETICO S.A");
        setAlwaysOnTop(true);
        setIconImage(getIconImage());
        setMaximumSize(new java.awt.Dimension(1280, 800));
        setName("frmMain"); // NOI18N
        setPreferredSize(new java.awt.Dimension(1280, 800));
        setResizable(false);

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/src/imagenes/logo.png"))); // NOI18N
        jLabel1.setBounds(10, 460, 600, 285);
        jDesktopPane1.add(jLabel1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/src/imagenes/AppBG.jpg"))); // NOI18N
        jLabel2.setBounds(0, 0, 1280, 800);
        jDesktopPane1.add(jLabel2, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jMenuBar1.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N

        menuArchivo.setText("Archivo");
        menuArchivo.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
        menuArchivo.setMargin(new java.awt.Insets(0, 0, 0, 2));

        jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem2.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
        jMenuItem2.setText("Salir");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        menuArchivo.add(jMenuItem2);

        jMenuBar1.add(menuArchivo);

        manuEditar.setText("Editar");
        manuEditar.setToolTipText("");
        manuEditar.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
        manuEditar.setMargin(new java.awt.Insets(0, 0, 0, 2));

        jMenuItem10.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem10.setText("Copiar");
        manuEditar.add(jMenuItem10);

        jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem1.setText("Cortar");
        manuEditar.add(jMenuItem1);

        jMenuItem9.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_V, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem9.setText("Pegar");
        manuEditar.add(jMenuItem9);

        jMenuBar1.add(manuEditar);

        menuModulos.setText("Módulos");
        menuModulos.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N

        menuCobro.setIcon(new javax.swing.ImageIcon(getClass().getResource("/src/imagenes/menu_cobro.png"))); // NOI18N
        menuCobro.setText("Cobro");
        menuCobro.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
        menuCobro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuCobroActionPerformed(evt);
            }
        });

        jMenuItem3.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
        jMenuItem3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/src/imagenes/menu_gestion_cobro.png"))); // NOI18N
        jMenuItem3.setText("Gestión de cobro");
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem3ActionPerformed(evt);
            }
        });
        menuCobro.add(jMenuItem3);

        menuModulos.add(menuCobro);
        menuModulos.add(jSeparator1);

        menuLocalizaciones.setIcon(new javax.swing.ImageIcon(getClass().getResource("/src/imagenes/menu_loc.png"))); // NOI18N
        menuLocalizaciones.setText("Localizaciones");
        menuLocalizaciones.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N

        jMenuItem8.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
        jMenuItem8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/src/imagenes/menu_cons_gen.png"))); // NOI18N
        jMenuItem8.setText("Consulta general");
        jMenuItem8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem8ActionPerformed(evt);
            }
        });
        menuLocalizaciones.add(jMenuItem8);

        menuModulos.add(menuLocalizaciones);
        menuModulos.add(jSeparator2);

        menuAdministracion.setIcon(new javax.swing.ImageIcon(getClass().getResource("/src/imagenes/menu_admin.png"))); // NOI18N
        menuAdministracion.setText("Administración");
        menuAdministracion.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N

        jMenuItem5.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
        jMenuItem5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/src/imagenes/menu_cliente.png"))); // NOI18N
        jMenuItem5.setText("Gestión de Clientes");
        jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem5ActionPerformed(evt);
            }
        });
        menuAdministracion.add(jMenuItem5);

        jMenuItem6.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
        jMenuItem6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/src/imagenes/menu_empleados.png"))); // NOI18N
        jMenuItem6.setText("Gestión de Empleados");
        jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem6ActionPerformed(evt);
            }
        });
        menuAdministracion.add(jMenuItem6);

        jMenuItem7.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
        jMenuItem7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/src/imagenes/menu_cartera.png"))); // NOI18N
        jMenuItem7.setText("Gestión de Cartera");
        jMenuItem7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem7ActionPerformed(evt);
            }
        });
        menuAdministracion.add(jMenuItem7);

        menuModulos.add(menuAdministracion);

        jMenuBar1.add(menuModulos);

        menuAyuda.setText("Ayuda");
        menuAyuda.setToolTipText("");
        menuAyuda.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N

        jMenuItem11.setText("Manual de Usuario");
        jMenuItem11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem11ActionPerformed(evt);
            }
        });
        menuAyuda.add(jMenuItem11);

        jMenuItem4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/src/imagenes/menu_acercade.png"))); // NOI18N
        jMenuItem4.setText("Acerca de");
        menuAyuda.add(jMenuItem4);

        jMenuBar1.add(menuAyuda);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jDesktopPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 1010, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 733, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
        conexion.closeConexion();
        System.exit(0);
    }//GEN-LAST:event_jMenuItem2ActionPerformed

    private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed
        frmAdminEmpleado fAdminEmpleado = new frmAdminEmpleado(this.conexion);
        Dimension desktopSize = jDesktopPane1.getSize();
        Dimension jInternalFrameSize = fAdminEmpleado.getSize();
        int width = (desktopSize.width - jInternalFrameSize.width) / 2;
        int height = (desktopSize.height - jInternalFrameSize.height) / 2;
        fAdminEmpleado.setLocation(width, height);
        jDesktopPane1.add(fAdminEmpleado);
        fAdminEmpleado.show();
    }//GEN-LAST:event_jMenuItem6ActionPerformed

    private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed
        frmAdminCliente fAdminCliente = new frmAdminCliente(this.conexion);
        Dimension desktopSize = jDesktopPane1.getSize();
        Dimension jInternalFrameSize = fAdminCliente.getSize();
        int width = (desktopSize.width - jInternalFrameSize.width) / 2;
        int height = (desktopSize.height - jInternalFrameSize.height) / 2;
        fAdminCliente.setLocation(width, height);
        jDesktopPane1.add(fAdminCliente);
        fAdminCliente.show();
    }//GEN-LAST:event_jMenuItem5ActionPerformed

    private void jMenuItem8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem8ActionPerformed
        frmConsultaGeneral fConsultaGeneral = new frmConsultaGeneral(this.conexion);
        Dimension desktopSize = jDesktopPane1.getSize();
        Dimension jInternalFrameSize = fConsultaGeneral.getSize();
        int width = (desktopSize.width - jInternalFrameSize.width) / 2;
        int height = (desktopSize.height - jInternalFrameSize.height) / 2;
        fConsultaGeneral.setLocation(width, height);
        jDesktopPane1.add(fConsultaGeneral);
        fConsultaGeneral.show();
    }//GEN-LAST:event_jMenuItem8ActionPerformed

    private void menuCobroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuCobroActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_menuCobroActionPerformed

    private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
        /*frmGestionCobro fGestionCobro = new frmGestionCobro();
        jDesktopPane1.add(fGestionCobro);
        fGestionCobro.show(); */
        frmCobro fCobro = new frmCobro(conexion);
        Dimension desktopSize = jDesktopPane1.getSize();
        Dimension jInternalFrameSize = fCobro.getSize();
        int width = (desktopSize.width - jInternalFrameSize.width) / 2;
        int height = (desktopSize.height - jInternalFrameSize.height) / 2;
        fCobro.setLocation(width, height);
        jDesktopPane1.add(fCobro);
        fCobro.show();
    }//GEN-LAST:event_jMenuItem3ActionPerformed

    private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem7ActionPerformed
        frmAdminCartera fAdminCartera = new frmAdminCartera(this.conexion);
        Dimension desktopSize = jDesktopPane1.getSize();
        Dimension jInternalFrameSize = fAdminCartera.getSize();
        int width = (desktopSize.width - jInternalFrameSize.width) / 2;
        int height = (desktopSize.height - jInternalFrameSize.height) / 2;
        fAdminCartera.setLocation(width, height);
        jDesktopPane1.add(fAdminCartera);
        fAdminCartera.show();
    }//GEN-LAST:event_jMenuItem7ActionPerformed

    private void jMenuItem11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem11ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem11ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
//        System.setProperty("file.encoding", "UTF-8");
//        String defaultCharacterEncoding = System.getProperty("file.encoding");
//        System.out.println("defaultCharacterEncoding by property: " + defaultCharacterEncoding);
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(frmMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(frmMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(frmMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(frmMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                frmLogin fLogin = new frmLogin();
                fLogin.setLocationRelativeTo(null);
                fLogin.setVisible(true);
                //frmMain fMain = new frmMain();
                // fMain.setExtendedState(JFrame.MAXIMIZED_BOTH);  Este codigo hace que la pantalla se ajuste a la resolucion de pantalla 
                //fMain.setVisible(true); 
                
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    public static javax.swing.JDesktopPane jDesktopPane1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuBar jMenuBar2;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem10;
    private javax.swing.JMenuItem jMenuItem11;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JMenuItem jMenuItem6;
    private javax.swing.JMenuItem jMenuItem7;
    private javax.swing.JMenuItem jMenuItem8;
    private javax.swing.JMenuItem jMenuItem9;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JPopupMenu.Separator jSeparator2;
    private javax.swing.JMenu manuEditar;
    private javax.swing.JMenu menuAdministracion;
    private javax.swing.JMenu menuArchivo;
    private javax.swing.JMenu menuAyuda;
    private javax.swing.JMenu menuCobro;
    private javax.swing.JMenu menuLocalizaciones;
    private javax.swing.JMenu menuModulos;
    // End of variables declaration//GEN-END:variables
}
